stackswitcher: Use the tablist and tab roles
authorMatthias Clasen <mclasen@redhat.com>
Wed, 14 Oct 2020 04:18:02 +0000 (00:18 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 15 Oct 2020 01:04:25 +0000 (21:04 -0400)
Set the tablist role on the stackswitcher itself, and
the tab role on the buttons. This is another step towards
implementing the tabs pattern for GtkStack.

gtk/gtkstackswitcher.c

index f9316f9a4d6cc4f5f623504b9edcc589aa833a50..e9cbfc9b907dfeba64c76abd300209c1f729ce26 100644 (file)
@@ -248,7 +248,9 @@ add_child (guint             position,
   GtkStackPage *page;
   GtkEventController *controller;
 
-  button = gtk_toggle_button_new ();
+  button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
+                         "accessible-role", GTK_ACCESSIBLE_ROLE_TAB,
+                         NULL);
   gtk_widget_set_focus_on_click (button, FALSE);
 
   controller = gtk_drop_controller_motion_new ();
@@ -498,6 +500,7 @@ gtk_stack_switcher_class_init (GtkStackSwitcherClass *class)
 
   gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
   gtk_widget_class_set_css_name (widget_class, I_("stackswitcher"));
+  gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TAB_LIST);
 }
 
 /**